package com.mh.enums;

/**
 * 资产变动类型枚举
 * @author zmh
 */
public enum AssetChangeType {
    BILL(1, "账单"),
    TRANSFER(3, "转账");

    private final Integer code;
    private final String description;

    AssetChangeType(Integer code, String description) {
        this.code = code;
        this.description = description;
    }

    public Integer getCode() {
        return code;
    }

    public String getDescription() {
        return description;
    }

    public static AssetChangeType fromCode(Integer code) {
        if (code == null) {
            return null;
        }
        for (AssetChangeType type : values()) {
            if (type.code.equals(code)) {
                return type;
            }
        }
        return null;
    }
}

